<template>
  <div>
    <mytop :title="title" />
    <div class="warp">
      <van-address-edit
        :area-list="areaList"
        show-postal
        show-set-default
        :area-columns-placeholder="['请选择', '请选择', '请选择']"
        @save="onSave"
      />
    </div>
  </div>
</template>

<script>
import mytop from 'components/My-Top'
import areaList from 'utils/area'
import { mapMutations } from 'vuex'
import { Toast } from 'vant'
export default {
  data () {
    return {
      title: '添加地址',
      areaList
    }
  },
  methods: {
    ...mapMutations('address', ['add_adress']),
    ...mapMutations('order', ['set_order_address']),
    onSave (content) {
      console.log(content)
      this.add_adress(content)
      this.set_order_address(content)
      Toast('添加成功')
      this.$router.go(-1)
    }
  },
  computed: {

  },
  components: {
    mytop
  }
}
</script>

<style lang="scss" scoped>
.warp {
  margin-top: 46px;
  margin-bottom: 50px;
}
</style>
